package com.twu.biblioteca.ui;

import com.twu.biblioteca.data.*;

/**
 * Created by florian on 26/12/13.
 */
public class ScreenControllerFactory {

    private final BibliotecaUI ui;
    private final BookDAO bookDAO;
    private final MovieDAO movieDAO;
    private final UserDAO userDAO;
    private final User user;

    public ScreenControllerFactory(BibliotecaUI ui,BookDAO bookDAO,MovieDAO movieDAO,UserDAO userDAO, User user) {
        this.ui = ui;
        this.bookDAO = bookDAO;
        this.movieDAO = movieDAO;
        this.userDAO = userDAO;
        this.user = user;
    }

    public ScreenController createMainScreenController() {
        return new MainScreenController(this, ui,bookDAO,movieDAO);
    }

    public ScreenController createMainScreenControllerLoggedIn(User user) {
        return new MainScreenControllerLoggedIn(new ScreenControllerFactory(ui,bookDAO,movieDAO,userDAO,user), ui,bookDAO,movieDAO,user);
    }

    public ScreenController createBookCheckoutScreenController() {
        return new BookCheckoutController(this, ui,bookDAO,user);
    }
    public ScreenController createMovieCheckoutScreenController() {
        return new MovieCheckoutController(this, ui,movieDAO,user);
    }

    public ScreenController createReturnBooksController() {
        return new ReturnController(this,ui,bookDAO,user);
    }

    public ScreenController createLoginPasswordController(User user) {
        return new LoginPasswordController(user,this,ui);
    }

    public ScreenController createLoginController() {
        return new LoginController(ui,userDAO,this);
    }
}
